{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#from jqdatasdk import *\n",
    "#import jqdatasdk\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "import csv\n",
    "#jqdatasdk.auth(“user”, “password”)\n",
    "\n",
    "import time\n",
    " \n",
    "start_time = time.time()\n",
    "\n",
    "a=['2015q1','2015q2','2015q3','2015q4',\n",
    "      '2016q1','2016q2','2016q3','2016q4',\n",
    "   '2017q1','2017q2','2017q3','2017q4',\n",
    "   '2018q1','2018q2','2018q3','2018q4',\n",
    "   '2019q1','2019q2','2019q3','2019q4',\n",
    "   '2020q1','2020q2','2020q3','2020q4',\n",
    "]#这一组数据是为了给获取的每季度财务数据命名和获取数据日期#\n",
    "\n",
    "for i in range(0,len(a)):\n",
    "    file = a[i]+'e.xlsx'\n",
    "    \n",
    "    c= get_fundamentals(query(valuation, balance,cash_flow, income,indicator),statDate=a[i])#这个命令在每个变量前加了df,比如2010年第一季度就是df20101q,如下,包含沪深300全部股票2010年季度的财务报表数据。\n",
    "    c.to_excel(file)\n",
    "# \n",
    "# for s in a:\n",
    "#     df[s].to.excel(writer,sheet_name=s)\n",
    "end_time = time.time()\n",
    "print(\"耗时: {:.2f}秒\".format(end_time - start_time))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
